<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends MY_Controller {

	public function __construct(){
		parent::__construct();
	}
	public function index()
	{
		$callback = $this->input->get("callback");
		
		$courseList = $this->getCourse();
		$username = $this->session->userdata('username');
		$result = array(
			"course"=>$courseList,
			"username" => $username
		);
		
		$result_json = json_encode($result);
		echo $callback."($result_json)";
	}
	
	public function getCourse(){
		$sql = "select * from future_u_c_course where level = 1";
		$data = $this->db->query($sql)->result_array();
		return $data;
	}
}